package my.app.timer;

import java.util.ArrayList;



import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class SongListAdapter extends ArrayAdapter<SongEntry> 
{
	private ArrayList<SongEntry> objects;
	private Context context;
	
	public SongListAdapter(Context context, ArrayList<SongEntry> objects)
	{
		super(context, R.layout.songlist_row, objects);

		this.objects = objects;
		this.context = context;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.songlist_row, parent, false);
		
		TextView titleView = (TextView) rowView.findViewById(R.id.title_text_id);
		titleView.setText(objects.get(position).songName);
		
		TextView descView = (TextView) rowView.findViewById(R.id.desc_text_id);
		descView.setText(objects.get(position).descriptionStr);
		
		return rowView;
	}
}
